package com.pet.article.controller.v1;

import com.pet.apis.article.ArticleHomeControllerApi;
import com.pet.article.service.ApArticleService;
import com.pet.common.constants.article.ArticleConstans;
import com.pet.model.article.dtos.ArticleHomeDto;
import com.pet.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/article")
public class ArticleHomeController implements ArticleHomeControllerApi {

    @Autowired
    private ApArticleService articleService;

    @PostMapping("/load")
    @Override
    public ResponseResult load(@RequestBody ArticleHomeDto dto) {
        return articleService.load(ArticleConstans.LOADTYPE_LOAD_MORE,dto);
    }

    @PostMapping("/loadlabel")
    @Override
    public ResponseResult loadlabel(@RequestBody ArticleHomeDto dto) {
        return articleService.loadlabel(ArticleConstans.LOADTYPE_LOAD_MORE,dto);
    }

    @PostMapping("/loadnew")
    @Override
    public ResponseResult loadNew(@RequestBody ArticleHomeDto dto) {
        return articleService.loadNew(ArticleConstans.LOADTYPE_LOAD_NEW,dto);
    }

    @PostMapping("/search")
    public ResponseResult search(@RequestBody ArticleHomeDto dto) {
        return articleService.search(dto);
    }
}